<?php
/****************************************
  * 导入finance_order  -  order_code 字段值
  *
 ********************************************/
namespace app\commands;

use Yii;
use yii\console\Controller;
use yii\web\NotFoundHttpException;
use app\modules\Order\models\Order;
use app\modules\Product\models\Product;
use app\modules\Finance\models\Finance;
use app\modules\Finance\models\FinanceOrder;

class FinanceController extends Controller
{

	/**
	* 导入默认值
	* @param combination  
	*/
    public function actionImport(){//{{{
		$data = FinanceOrder::find()->all();

		foreach($data as $model){
			$order = Order::findOne($model->order_id);

			$model->order_code = $order->code;
			$model->save();
		}
	}//}}}


    public function actionProduct(){//{{{
		$data = FinanceOrder::find()->all();

		foreach($data as $model){
			$product = Product::findOne($model->product_id);

			$model->product_code = $product->code;
			$model->save();
		}
	}//}}}
	
}
